package com.mjduan.myBank.record.dao.daoImpl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate4.HibernateTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.mjduan.myBank.record.dao.IRecordDao;
import com.mjduan.myBank.util.entity.Record;

@Component("RecordDaoImpl")
@Transactional(rollbackFor = Exception.class)
public class RecordDaoImpl implements IRecordDao {
    @Autowired
    private HibernateTemplate hibernateTemplate;

    @Override
    public boolean addRecord(Record record) {
        long id = (long) hibernateTemplate.save(record);
        return id > 0;
    }
}
